deactivate_{$plugin}
Action HookDescription
Fires as a specific plugin is being deactivated. This hook is the "deactivation" hook used internally by register_deactivation_hook(). The dynamic portion of the hook name, `$plugin`, refers to the plugin basename. If a plugin is silently deactivated (such as during an update), this hook does not fire.Hook Information
File Location |
wp-admin/includes/plugin.php
View on GitHub
|
Hook Type | Action |
Line Number | 826 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$network_deactivating
|
Whether the plugin is deactivated for all sites in the network or just the current site. Multisite only. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into deactivate_{$plugin}
add_action('deactivate_{$plugin}', 'my_custom_function', 10, 1);
function my_custom_function($network_deactivating) {
// Your custom code here
}
Source Code Context
wp-admin/includes/plugin.php:826
- How this hook is used in WordPress core
<?php
821 * @since 2.0.0
822 *
823 * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
824 * or just the current site. Multisite only. Default false.
825 */
826 do_action( "deactivate_{$plugin}", $network_deactivating );
827
828 /**
829 * Fires after a plugin is deactivated.
830 *
831 * If a plugin is silently deactivated (such as during an update),
PHP Documentation
<?php
/**
* Fires as a specific plugin is being deactivated.
*
* This hook is the "deactivation" hook used internally by register_deactivation_hook().
* The dynamic portion of the hook name, `$plugin`, refers to the plugin basename.
*
* If a plugin is silently deactivated (such as during an update), this hook does not fire.
*
* @since 2.0.0
*
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
* or just the current site. Multisite only. Default false.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-admin/includes/plugin.php
Related Hooks
Related hooks will be displayed here in future updates.